cleanups + bugfix