Fixed scoping issue on io