added geometry check. Didn't modify the function in postgres since it was working well on my machine. Need to test on RC I reckon