mod: casting optimization
renderer2: better division by zero check, refs #688