Use exception safe function

`atoi()` will never return an error nor an exception. `std::stoi()` is exception safe.