wrapper substitution and onLoad events fixes