Fixed getNextOrderNumber method when several orders overlap