Fixed itrate function