Fixed javascript load utility function