changed getkey for waitkey