fix crash when panning the picture