Correctly handle state when loading new image and filter