allow to disable touch input and one more bug fix

I wanted to be able to disable touch input in some cases, so I just implemented a lock and unlock method. I thought you might find it useful as well...

The other commit is a better solution for the bug I fixed in the last pull request, hope you can include it.

Thanks!