Fix a bug where iterating over 0 objects crashed