Fix bugs and correct touch events