fixing bugs around loading js libs