Fix "Can't call method "res" on an undefined value ..."