fixed bug with the mem check