fixed segfault in 1D-c++ :D