a few annoying performance-related bugfixes