Test and fix for wrong hash comparison after roundtrip to db.