Thanks dave@ for the suggestion and Rohan Jain for the patch.
Thanks rafadev for the report and Javier Mansilla for the fix.