added try catch in server