small improvements and bugfix