Fixes #904

#884 depends on #904