Avoid division by zero error in cpat (fixes #517). Cleanly avoid running cpat if not installed