Fixed emaildao.unlock, added tests