Fixes #1016, please check