fix wrong sqrt function