Fix issues regarding JSON and Base64 encoding