Yes, the problem occurred in the calculation of the correlation coefficient. I have introduced a special case for this situation, returning a value of 1.