added d res mhe if (buggy)