checking if key is valid or not