fix possible sigseg