fixed a bug that set the image too many times