smart little bug related to variable scope fixed