lua: add uci.foreach() error handling patch by xMff