Improve ST_Distance

@mlecoeuvre Please see these corrections.