Added check for bad json in contracts table