Merge in upstream changes, update gs and imagemagick