fix ucs, some improvements