fix no-remainder logic