Fix basePath calculation making it adaptable