Fixed some bugs for loading the json