bugfixes, some minor improvements