Fixed segmentation violation (std::vector resize instead of reserve)