fixed a bug when selected file name contains spaces