added tests, small fixes