fix a bug that appears when receiving data