Fix for issue #471 and issue #579