fix bugs on client/server packet receiving