Minor rework of tmp database