Take care about read and write.

Fix bug when reading lastlog files.