Fix crash when image name comes with no extension