fixed a critical bug that some data cannot be sent fully in case of the data to be sent is very large