fix pop list function