Changes to resolve the sql errors.