Fixed possible bug with keys