Fix wrong namespaces in sequences when imports are used.

Add unit test.