couple of bugfixes and enhancements before another refactor