added trycatch block