fixing dept loop