database: fix regression bug