proper scoping for 'if'