updated to work with latest version of libpng