bugfixes and small enhancements