basePath detection fixed