misc bugfixes