Add receive data func
Fix receive data func bugs. It works.