Exception fix when jQuery called