implementing `dec` and `last`