fixed overflow error when saving indexed pngs (closes issue #3)