Changed some server logic. Added a try catch for the std::out_of_range.