$result is only declared inside  this if and can be undefined in line 246 below. Again as above: do we need this backend check? 
There is only one backend.