Fixed bugs in DAO