fix sortandalign skipping images and improve error message display