iOS 6.x compatibality and bug fixes

iOS 6.x compatibality
Fix bugs related to reading values correctly from preferences.