Fixing bug in update_db