Fix receive data func bugs. It works.