Fixed replayer algorithm in tern.