Avoid div-by-zero, validate upem
2 files changed