Fixes infinitely running sqrtErr function