handle situation when number of source images is less than 'num_per_row'