Minor fixes when unexpected error occured