Fixing bug with input handler