minor bugfixes and new tests