Use iOS 7 base64 methods and fix memory leaks