diff --git a/contrib/scripts/install_prereq b/contrib/scripts/install_prereq
index 1359f9b841eceb09151435e7a988b1c523f96f0f..8fc66cc454a55b442cb89e948cb5e1dbfc9fa0e6 100755
--- a/contrib/scripts/install_prereq
+++ b/contrib/scripts/install_prereq
@@ -50,8 +50,12 @@ in_test_mode() {
 }
 
 check_installed_debs() {
-	aptitude -F '%c %p' search "$@" 2>/dev/null \
-	| awk '/^p/{print $2}'
+	for pack in "$@"
+	do
+		tocheck="${tocheck} ^${pack}$"
+	done
+	aptitude -F '%c %p' search ${tocheck} 2>/dev/null \
+ 	| awk '/^p/{print $2}'
 }
 
 # parsing the output of yum is close to impossible.