Fixed a nasty bug