fixed bug with keyboard state - thanks to jgmdev