fix leak in pop/shift

fix leaks