added check for cases where key cannot be authorized.