add try catch to avoid core dump