more error checking

Change-Id: I606b92fd102836aff591afbd37db9e0586bf855e
Now using Base64 Strings in place of byte[] in JSON objects.

Change-Id: I56d48331c62362b3a47ad22bdaee0370644a6820