Fixed subtraction bug in modulo