improved the way of getting the base path