fix a small bug in saveObjectAsPlist function