Fixed library bugs (probably a result of the SDK upgrade)