fix bug makes server crashed