Found a more stable way of creating the InjectedScript class.