fix parity flag calculation