Fix for iOS6 compatability.
Merge pull request #82 from ChrisGrant/bugs

Fix for iOS6 compatability.