pass nSelections
shorten file name when one selection only
repair sample code