Improve ST_GeometryN (pending #200).

@mlecoeuvre Please see these corrections.