modified the package function for libpng