cleanup & bugfixes