Fixed DAO and related tests.

Signed-off-by: Paulo Pires <pjpires@gmail.com>