Fix check for keys