Fixed Null Pointer Exception in shared Preferences