Merge pull request #58 from cvictory/fix/support_return_length

Ftr: return the total length and write length