Fixes issue #1570

Here a quick fix for issue #1570.
Test was also updated.