F: fix scoping of variables