fix a bug may crash the program when parsing PNG