Fixed bugs in NSUserDefaults