another round of bugfixes