Changing `string.toFunction()` such that it works with Firefox