Fixes #941, fixes #1056