Bugfixes and slight improvements.