fixed tests and some bugs due to test runs