read and write object under file lock