test codes for saving object to file