Add logic for supporting old db