updated tests, fixed bugs