add try except block around json.loads to prevent errors