fix a bug causes server crash