fix some old code to work with lazy loaded jquery