use delay instead of defer