diff --git a/LOFARBeam-buildfix.patch b/LOFARBeam-buildfix.patch
new file mode 100644
index 0000000000000000000000000000000000000000..e64ccc0849f8e8f10da777daf43d19ede3b3ad83
--- /dev/null
+++ b/LOFARBeam-buildfix.patch
@@ -0,0 +1,81 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 2867d9c..7d41a23 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,4 +1,4 @@
+-cmake_minimum_required(VERSION 3.0.0)
++cmake_minimum_required(VERSION 3.5.0)
+ 
+ project(lofarbeam)
+ 
+@@ -65,37 +65,40 @@ elseif(DOXYGEN_FOUND)
+ 
+ endif(DOXYGEN_FOUND)
+ 
++# ThOr: This is NOT the modern cmake-included FindPython!
+ find_package (Python COMPONENTS Development)
++
+ message("Compiling Python ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} support. If this is not the intended target use 'DPYTHON_EXECUTABLE' to control.")
+ # bind against boost-python for compilation of the python API
+ # depending on major release version of the python libraries
+-if (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
+-  find_package (Boost REQUIRED COMPONENTS python numpy)
+-  find_package (Casacore REQUIRED COMPONENTS python)
+-  message(STATUS "Boost python library: ${Boost_PYTHON_LIBRARY}")
+-  message(STATUS "Boost numpy library: ${Boost_NUMPY_LIBRARY}")
+-  message(STATUS "Python library ${PYTHON_LIBRARIES}")
+-  set(BOOST_PY_FOUND TRUE)
+-else (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
+-  find_package (Boost REQUIRED COMPONENTS python3 numpy3)
+-  find_package (Casacore REQUIRED COMPONENTS python3)
+-  message(STATUS "Boost python library: ${Boost_PYTHON3_LIBRARY}")
+-  message(STATUS "Boost numpy library: ${Boost_NUMPY3_LIBRARY}")
+-  message(STATUS "Python library ${PYTHON_LIBRARIES}")
+-  set(BOOST_PY_FOUND TRUE)
+-endif (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
+-
+-
+-if(BOOST_PY_FOUND)
+-    add_library(_stationresponse MODULE pystationresponse.cc)
+-    set_target_properties(_stationresponse PROPERTIES PREFIX "")
+-    target_include_directories(_stationresponse PRIVATE ${PYTHON_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
+-    if (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
+-      target_link_libraries(_stationresponse stationresponse ${CASA_PYTHON_LIBRARY} ${Boost_PYTHON_LIBRARY} ${Boost_NUMPY_LIBRARY} ${PYTHON_LIBRARIES})
+-    else (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
+-      target_link_libraries(_stationresponse stationresponse ${CASA_PYTHON3_LIBRARY} ${Boost_PYTHON3_LIBRARY} ${Boost_NUMPY3_LIBRARY} ${PYTHON_LIBRARIES})
+-    endif (${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
+-    install(TARGETS _stationresponse DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
+-    install(FILES __init__.py DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
+-endif(BOOST_PY_FOUND)
+-
++if(${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
++  set(casapy "")
++  set(oldboostpy "")
++else()
++  set(casapy "3")
++  set(oldboostpy "3")
++endif()
++set(boostpy ${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR})
++message("trying boostpy=${boostpy}")
++find_package(Boost 1.67.0 COMPONENTS python${boostpy} numpy${boostpy})
++if(NOT Boost_FOUND)
++  message(STATUS "Falling back to old Boost search.")
++  set(boostpy ${oldboostpy})
++  find_package(Boost REQUIRED COMPONENTS python${boostpy} numpy${boostpy})
++endif()
++find_package (Casacore REQUIRED COMPONENTS python${casapy})
++if(${PYTHON_VERSION_MAJOR} VERSION_LESS "3")
++  set(casapylib ${CASA_PYTHON_LIBRARY})
++else()
++endif()
++
++message(STATUS "Boost python library: ${Boost_PYTHON_LIBRARY}")
++message(STATUS "Boost numpy library: ${Boost_NUMPY_LIBRARY}")
++message(STATUS "Python library ${Python_LIBRARIES}")
++
++add_library(_stationresponse MODULE pystationresponse.cc)
++set_target_properties(_stationresponse PROPERTIES PREFIX "")
++target_include_directories(_stationresponse PRIVATE ${PYTHON_INCLUDE_DIR} ${Boost_INCLUDE_DIRS})
++target_link_libraries(_stationresponse stationresponse ${casapylib} Boost::python${boostpy} Boost::numpy${boostpy} ${PYTHON_LIBRARIES})
++install(TARGETS _stationresponse DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
++install(FILES __init__.py DESTINATION ${PYTHON_INSTALL_DIR}/lofar/stationresponse)
diff --git a/aoflagger-buildfix.patch b/aoflagger-buildfix.patch
index efdcb3622b936c8a546615ff354c1f8f75345e5c..28d6068a2aa7e1a068f4b8732dc276d693a0f4b7 100644
--- a/aoflagger-buildfix.patch
+++ b/aoflagger-buildfix.patch
@@ -1,26 +1,44 @@
 diff --git a/CMakeLists.txt b/CMakeLists.txt
-index fd1d7c7..37b00ea 100644
+index fd1d7c7..777a05e 100644
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -29,14 +29,22 @@ find_package(PNG REQUIRED)
+@@ -25,18 +25,35 @@ find_path(GSL_INCLUDE_DIR NAMES gsl/gsl_version.h)
+ find_package(Threads REQUIRED)
+ find_package(LibXml2 REQUIRED)
+ find_package(PNG REQUIRED)
++find_package(Python COMPONENTS Interpreter Development)
++if(NOT Python_FOUND)
++  message(STATUS "Falling back to deprecated Python search.")
++  find_package(PythonInterp REQUIRED)
++  find_package(PythonLibs REQUIRED)
++  set(Python_VERSION ${PYTHON_VERSION_STRING})
++  set(Python_VERSION_MAJOR ${PYTHON_VERSION_MAJOR})
++  set(Python_VERSION_MINOR ${PYTHON_VERSION_MINOR})
++  set(Python_LIBRARIES ${PYTHON_LIBRARIES})
++  set(Python_INCLUDE_DIRS ${PYTHON_INCLUDE_DIRS})
++endif()
++message(STATUS "Using python version ${Python_VERSION}")
+ #Prevent accidentally finding old BoostConfig.cmake file from casapy
  set(Boost_NO_BOOST_CMAKE ON)
- #set(PY_VERSION 3)
- #find_package(PythonLibs ${PY_VERSION} REQUIRED)
+-#set(PY_VERSION 3)
+-#find_package(PythonLibs ${PY_VERSION} REQUIRED)
 -find_package(PythonInterp REQUIRED)
-+#find_package(PythonInterp REQUIRED)
- #find_package(PythonLibs ${PYTHON_VERSION_STRING} REQUIRED)
+-#find_package(PythonLibs ${PYTHON_VERSION_STRING} REQUIRED)
 -find_package(PythonLibs 2.7 REQUIRED)
-+#find_package(PythonLibs 2.7 REQUIRED)
-+# CMake since 3.12 wants you to use this.
-+find_package(Python3 REQUIRED COMPONENTS Interpreter Development)
-+set(boostpython python${Python3_VERSION_MAJOR}${Python3_VERSION_MINOR})
- #message(STATUS "Using python version ${PYTHON_VERSION_STRING}")
+-#message(STATUS "Using python version ${PYTHON_VERSION_STRING}")
  # At least the intrusive_ref_counter needs Boost 1.55 (because the header was moved)
 -find_package(Boost 1.55.0 REQUIRED COMPONENTS date_time filesystem python system)
-+# Bumped to 1.67 to be able to proper python suffix. You may complicate the
-+# code again to support older versions, too.
-+find_package(Boost 1.67.0 REQUIRED COMPONENTS date_time filesystem ${boostpython} system)
- #find_package(Boost REQUIRED COMPONENTS date_time filesystem python-py36 system)
+-#find_package(Boost REQUIRED COMPONENTS date_time filesystem python-py36 system)
++# Bumped to 1.67 to be able to use proper python suffix. One attempt
++# to support at least two boost_python naming schemes here.
++set(boostpython python${Python_VERSION_MAJOR}${Python_VERSION_MINOR})
++find_package(Boost 1.67.0 COMPONENTS date_time filesystem ${boostpython} system)
++if(NOT Boost_FOUND)
++  message(STATUS "Falling back to old Boost search.")
++  set(boostpython python)
++  find_package(Boost 1.55.0  REQUIRED COMPONENTS date_time filesystem ${boostpython} system)
++endif()
++
  find_library(FFTW3_LIB fftw3 REQUIRED)
 +# Not sure if this is needed everywhere, but I get linker
 +# errors with missing symbols if not explicitly linking to fftw3_threads.
@@ -28,17 +46,17 @@ index fd1d7c7..37b00ea 100644
  enable_language(Fortran OPTIONAL)
  find_package(BLAS REQUIRED)
  find_package(LAPACK REQUIRED)
-@@ -53,7 +61,7 @@ include_directories(${FFTW3_INCLUDE_DIR})
+@@ -53,7 +70,7 @@ include_directories(${FFTW3_INCLUDE_DIR})
  if(GSL_INCLUDE_DIR)
  	include_directories(${GSL_INCLUDE_DIR})
  endif(GSL_INCLUDE_DIR)
 -include_directories(${PYTHON_INCLUDE_DIRS})
-+include_directories(${Python3_INCLUDE_DIRS})
++include_directories(${Python_INCLUDE_DIRS})
  
  # The following stuff will set the "rpath" correctly, so that
  # LD_LIBRARY_PATH doesn't have to be set.
 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
-index 4a36e1c..be7fdcf 100644
+index 4a36e1c..55713b2 100644
 --- a/src/CMakeLists.txt
 +++ b/src/CMakeLists.txt
 @@ -235,17 +235,17 @@ set(PYTHON_FILES
@@ -61,7 +79,7 @@ index 4a36e1c..be7fdcf 100644
  	${CMAKE_THREAD_LIBS_INIT}
  	${PNG_LIBRARIES} ${LIBXML2_LIBRARIES}
 -	${PYTHON_LIBRARIES})
-+	${Python3_LIBRARIES})
++	${Python_LIBRARIES})
  
  if(GTKMM_FOUND)
  	message(STATUS "GTKMM found.")