Fixed sqrt function