bugfixes and minor improvements
minor bugfixes