added more try-catch