Fix perfect dividend bug