diff --git a/lab3/assignment3.R b/lab3/assignment3.R
index fe91786a70f7dde06f7d69a8775d80a15297d52d..18d9602eba53ae4b4581b67b14fbc747a7e07106 100644
--- a/lab3/assignment3.R
+++ b/lab3/assignment3.R
@@ -89,9 +89,7 @@ err3
 
 # 3. Implementation of SVM predictions.
 
-rbf_kernel <- function(x1, x2, lambda = 0.05) {
-  exp(-(dist(rbind(x1,x2)) ^ 2) * lambda)
-}
+rbf_kernel <- rbfdot(sigma = 0.05)
 
 sv <- alphaindex(filter3)[[1]]
 co <- coef(filter3)[[1]]
@@ -100,9 +98,9 @@ k <- NULL
 for (i in 1:10) {
   # We produce predictions for just the first 10 points in the dataset.
   k2 <- inte
-  data_point <- spam[i, -58]
+  data_point <- as.numeric(spam[i, -58])
   for (j in 1:length(sv)) {
-    support_vector <- spam[sv[j], -58]
+    support_vector <- as.numeric(spam[sv[j], -58])
     kernel_value <- rbf_kernel(support_vector, data_point)
     k2 <- k2 + co[j] * kernel_value
   }