FIX: fixed an issue with NaN in GradientDescent caused by acos(x), added more debug info to errorfunction validation