bugfixes and some cleanups