FIx the modulo arithmetic