fixed most testing issues related to database