Fix JSON error and logging errors