fix warnings
input events: simplify code, fix resource leakage