Fix bugs.

1. Fix 32/64 bug.
2. Fix readn/writen logic bug.

Signed-off-by: YunchaoChen <ytu_cyc@126.com>