Fixes to deal with newer png lib and C++11, as suggested by Mark van Rossum.