fixed segfault by switch from c-style array to std::array