fix bug: imageIdx was not updated when image switched