Bugfixes and polish