Fixing nasty bug