Update readExternal and writeExternal