bugfixes, minor improvements