Fix #357 (with thanks to @I3rixon)