Oregon Department of Human Services has agreed not to house foster children in hotels or its offices unless it is an emergency, according to a settlement of a lawsuit announced on Tuesday.

In September, lawyers for foster children filed the class action lawsuit saying DHS broke the law by failing to find them appropriate housing. In the suit, attorneys described the practice of housing kids in hotels, offices, hospitals — and a jail, in one extreme case.