Fix assignment logic