various bugfixes and namespace changes