stubs: fix broken un-stubbing

A local variable was used and hence stubs wasn't registered, which in
turn resulted in stubs not being unset.