fixed sqrt domain error