Some minor changes and catching a nullpointer when the key does not have critical extensions