Clearing the canvas as often as possbile to avoid crashing