fix bug when writing to plist