bugfixes and build errors