fix segfault
...and fix a leftover cout
remove previously added cfg parameter, update segment fit logic