avoid trying to read invalid memory as png