a fix for a nasty bug