small improvements and bug fixes