handled secure_key validation better