Fixed error messages for invalid images