modified completefunc