--- a/src/hugin_cpfind/localfeatures/KeyPoint.h
+++ b/src/hugin_cpfind/localfeatures/KeyPoint.h
@@ -109,9 +109,16 @@
 class KeyPointPtrSort
 {
 public: 
-        inline bool operator() (const KeyPointPtr& a, const KeyPointPtr& b) const { 
-                return (a->_score < b->_score); 
-        } 
+	inline bool operator() (const KeyPointPtr& a, const KeyPointPtr& b) const {
+		if (a->_score < b->_score) {
+			return true;
+		} else if (a->_score > b->_score) {
+			return false;
+		} else {
+			// same score, order by orientation
+			return (a->_ori < b->_ori);
+		}
+	} 
 };
 
 }