add exception handling for fetching contents