fix bug in removeLast