manually merged PR from @frankmayer
manually merged issue #643 by @frankmayer