fix and simplify IOUS check
unindent at the end of resources if needed in the IOUS check