fixed removeLast and removeFirst problem