diff --git a/xbob/flandmark/ext/ext.cpp b/xbob/flandmark/ext/ext.cpp
index 9fc71a1d93defac923356cc510ac3f9c698ade04..767ad38077e08cbb16c8aee4ccd04b551918bcb7 100644
--- a/xbob/flandmark/ext/ext.cpp
+++ b/xbob/flandmark/ext/ext.cpp
@@ -8,8 +8,16 @@
 #include <boost/python.hpp>
 #include <boost/shared_ptr.hpp>
 #include <boost/shared_array.hpp>
-#include <bob/core/python/gil.h>
-#include <bob/core/python/ndarray.h>
+
+#include <bob/config.h>
+#ifdef BOB_API_VERSION
+#  include <bob/python/gil.h>
+#  include <bob/python/ndarray.h>
+#else
+#  include <bob/core/python/gil.h>
+#  include <bob/core/python/ndarray.h>
+#endif
+
 #include <cv.h>
 
 #include "flandmark_detector.h"