Fixed minor scoping issues.