Fix loops over $fields Closes #247