fix subtle bug in getkey