Corrected mistakes in the computation of SSD. Mask image was not used correctly