some changes on read and write method