Added PNG error checking.