Fixed javascript with callback