made JSON more robust