handle different cases