Fixed scoping issue