Fix legend when returning to a previous image with back/forward or zooming