Missed some variable declarations
Integrated fixes from henrikbrixandersen pull request #504