Fix for self.cycles[-1] throwing exception if empty