Fix corrupted db ... thus fixes failing test
Fix the ugly hack in crypto.py