fixes issues with namespacing using class

this resolved multiple use cases and issues with namespacing libraries with class instead of module.