Fix for infinity loop under IE