fix scoping errors revealed by use strict