Should fix #880
Please revert if this is not correct.