generate $delegate when needed

generate $delegate instance only when dependency exists