bugfixes, extended tests