removing trailing dir