fixed shadowed outer variable