udpated tests, fixed bugs