Bug fixes
Added Tests for DB