fix loading of script and returning values from javascript