Fix some bugs for jquery conversion