Fix #474. Thanks to @georgexsh and @trbs