changed set-rsmof loop