add base directory if needed