fixed library + issues for iOS8

tested on iOS8 and iOS7