Added fix for case where rmt calls returns a non list and a for-each crashes.