Fixed bug mentioned in #943