Fixed bugs with old db