utility functions regarding the last element in a list