Fix undefined jquery exception