Bugfixes and small improvements.