Minor improvements and bugfixes