Fixing db code