json error check added