Partly fixes #1861