update tests and couple bugfixes