fix up type casting
fix narrowing issue in miniz - closes #1967