Fixes #1778
Better fix for #1777