changed tests and fixed bugs