added Database class tests, fixed bugs