Bugfix for issue-504