Fix object scoping issue