Fix bug with mouseout and mouseup