Fixed bug with undefined key code