Fix the scope implementation

The parameter lookup was not recursive.