Fix some bugs regarding OMS by introducing a new helper function