Correction of the IMS correction implementation. Correct now, but hasn't been tested with different phi values