refactor unnecessary key-checking