add Test classes and bugfixes