fixed the logic for passing image ID