Fixed various shadowing issues pointed out by compiler warnings.