Fixed crash when perfect image is given