added safety net check