change to use '->at(-1)'