prettyfy some lines and fix the touchend state