Fixes #368 for master