Minor bugfixes and enhancements