Accounted for NaNs in images and corrected x/y mixups.