fixed issue with basename and trailing /