Bugs fix and new db working