pops first element instead of last