add return error if data lost
Merge pull request #1025 from huili2/EC_return_error

add return error if data lost