added mem check