updated nextTick workaround