correct bug: one should use isqrt