Fixes for IE & self/global thing.
Fix off by one error in replay.