Modify empty/null namespace check as suggested by Jean-Marie