Fix #39

Avoid declaring variable in middle of code block