Fixed bug in mouse handler and update tests