Merge "Fix integer overflow and divide-by-zero" into klp-dev