Bugfix for issue-585