Fix odd scoping bugs.