moved all tests to phpunit, bugfixes