corrected code to deal with some runit quirks
corrected