fixed bug in filenames using ~