better support for touch devices and minor bug fix