add check for environment before deleting key.