avoid using basename,dirname