clean old functions in db