Fixed some model and jquery issues