fixed 'index' is defined but never used.