Fixed bugs related to touch event handling