Fixes and debug feature to hunt database-breaking features down