Fixing bug in libpng