Bugfix for issue-506