fixed little bug where we tried access last element of `sections` list
without first checking if the list's empty.