fixed minor bugs
added database tests