fix for issue #595 and #425