Fix some modulo issues