Fix a couple of bugs with empty lists