Fixes #862
Fixes #1094