Fixing a big memory leaks with geometries