add the exception handling more than before