SQUASHME: prevent overflow and division by zero