Fixed bugs with jquery