fixed bugs introduced when renaming variables