check if image exists before loading