Fixed bug described in fri's comment on #52