Fixed collapse error, moved js to right  place