changed so that can divide by zero