added few tests adn db bug fixes