fix an uncaught bad lexical cast exception

coverity reports that it would crash the server