bugfixes and new features. all tests passed