Fixed errors in the touch screen logic.