Fix undefined variable notices