Added testfiles and bugfixes