In order to suppress the effect of channel length modulation, a cascode current mirror can be used. As shown in figure below, one more transistor M3 is added. In the circuit of basic current mirror and Vb is chosen such that Vx = Vy, then Iout closely tracks Iref.