fixing problem with key check