Fix errors with jquery by placing scripts at the bottom of each page,and required self and tree again