Bugfix for issue #46