Fixed #1624 (thanks @abraithwaite)