Some small improvements and bugfixes