Added next index on onLeave callback.