added tests and fixed failed tests