fix curElem,prevElem