--- a/ImageMatchModel.c
+++ b/ImageMatchModel.c
@@ -50,8 +50,8 @@
 	
 	// TODO: least-square match if more than two points are given.
 	// For now, just ignore any further matches.
-	self->m1 = ArrayList_GetItem(matches, 0);
-	self->m2 = ArrayList_GetItem(matches, 1);
+	self->m1 = (Match *) ArrayList_GetItem(matches, 0);
+	self->m2 = (Match *) ArrayList_GetItem(matches, 1);
 	
 	//WriteLine ("Doing transform building...");
 	self->trans = AffineTransform2D_BuildTransformFromTwoPairs
@@ -111,7 +111,7 @@
 				   pow (self->m1->kp2->y - self->m2->kp2->y, 2));
 
 	double distanceTerm = distXA + distXB - distAB;
-	distanceTerm /= sqrt (pow (self->width, 2) + pow (self->height, 2));
+	distanceTerm /= sqrt (pow (self->width, 2.0) + pow (self->height, 2.0));
 	double distanceReduce = self->distanceFactor * distanceTerm * self->fitThresh;
 	/*WriteLine ("reducing distance %f by %f due to distance term %f, thresh %f",
 	  pixDistance, distanceReduce, distanceTerm, fitThresh);*/
@@ -154,16 +154,16 @@
 
 
 IRANSACModel ImageMatchModel_vtbl = {
-	ImageMatchModel_clone,
-	ImageMatchModel_delete,
-	ImageMatchModel_FitModel,
-	ImageMatchModel_FittingErrorSingle,
-	ImageMatchModel_ThreshholdPoint,
-	ImageMatchModel_GetFittingErrorSum,
-	ImageMatchModel_SetFittingErrorSum,
-	ImageMatchModel_GetFittingGround,
-	ImageMatchModel_SetFittingGround,
-	ImageMatchModel_CompareTo
+	(IRANSACModel *( *)(IRANSACModel *)) ImageMatchModel_clone,
+	(void ( *)(IRANSACModel *))ImageMatchModel_delete,
+	(int ( *)(IRANSACModel *,ArrayList *)) ImageMatchModel_FitModel,
+	(double ( *)(IRANSACModel *,void *))ImageMatchModel_FittingErrorSingle,
+	(int ( *)(IRANSACModel *,double)) ImageMatchModel_ThreshholdPoint,
+	(double ( *)(IRANSACModel *)) ImageMatchModel_GetFittingErrorSum,
+	(void ( *)(IRANSACModel *,double)) ImageMatchModel_SetFittingErrorSum,
+	(ArrayList *( *)(IRANSACModel *)) ImageMatchModel_GetFittingGround,
+	(void ( *)(IRANSACModel *,ArrayList *)) ImageMatchModel_SetFittingGround,
+	(int ( *)(IComparator *,IRANSACModel *,IRANSACModel *)) ImageMatchModel_CompareTo
 };
 
 
@@ -246,7 +246,7 @@
 		return (NULL);
 	}
 
-	ImageMatchModel* best = ArrayList_GetItem(models, 0);
+	ImageMatchModel* best = (ImageMatchModel*) ArrayList_GetItem(models, 0);
 	// Make sure best doesn't get erased by ArrayList_delete below.
 	ArrayList_SetItem(models, 0, NULL);