fixed jquery problem and bugs