Fix error handling for namespace