fixed bug in checking for keys (if keys aren't there at all)