misc bugfixes & improvements