cleanups + bugfixes