Handle modules/namespaces with global prefix

Fix #658.
Only trim global namespace if it is an exact prefix
Merge pull request #659 from dungpa/global-namespace

Handle modules/namespaces with global prefix