Fix #114

Patch by Decathlon, tests by me.