Handle modules/namespaces with global prefix

Fix #658.