added update entry option. Fixed minor bugs in read/write.