Fixed bug in assigning residents to cells