Add guard to key import