fixed problem with duplicated variable names, reported by Arun