TSA rules led to pilot’s gun firing in flight