Fix tests and apply some tweaks to a few DAO methods.