Prevent errors when last_element is a number.