cleanup and fixed tests