reduce variable scope

Signed-off-by: Sami Kerola <kerolasa@iki.fi>