The res may become undefined when nothing returns, to prevent exceptions. Pls add a check.