fix issue where jQuery ready event gets called twice