catch exceptions that may occur, coverity issue 1198845