minor bugfixes, new tests