bugfixes, adding legacy tests