fix bug wherein geometry references were freed too early