two fixes in learn: MAP image type, image order in case num_imges is not a multiple of num_levels