fixed wrong index when containerDiv is appended back to the page