try to handle more potential errors