Fix mem-leak in OriginDBHelper
Refine code