Fixed issue with JQuery being executed before loaded