Fixed some should-be-local variables