register this directly after the request or directly after you check res on line 189 etc.