database: avoid empty trees