diff --git a/dom.d b/dom.d
index 988b089..98a134a 100644
--- a/dom.d
+++ b/dom.d
@@ -5042,7 +5042,7 @@ class Table : Element {
 			return position;
 		}
 
-		foreach(int i, rowElement; rows) {
+		foreach(i, rowElement; rows) {
 			auto row = cast(TableRow) rowElement;
 			assert(row !is null);
 			assert(i < ret.length);
@@ -5059,7 +5059,7 @@ class Table : Element {
 				foreach(int j; 0 .. cell.colspan) {
 					foreach(int k; 0 .. cell.rowspan)
 						// if the first row, always append.
-						insertCell(k + i, k == 0 ? -1 : position, cell);
+						insertCell(k + cast(int) i, k == 0 ? -1 : position, cell);
 					position++;
 				}
 			}