fix Database insert/retrieve/delete bugs.