tryCatch block added