fix divide by zero error.
improve tools for identifying best parameters.