Fixed bug mentioned in #891