bugfixes
bugfixes and assertions