Fixes #1004.