added check for keys