diff --git a/CHANGES/v2.4.md b/CHANGES/v2.4.md
index 1c27293ca74dd4ce3956a70211a97005409c47a0..7ea50e4246f6e6811c6f69d4bd5492c8db393401 100644
--- a/CHANGES/v2.4.md
+++ b/CHANGES/v2.4.md
@@ -243,5 +243,6 @@ For users:
   - Fixed a bug with \ref CONVERT_TO_FES and periodic variables, see \issue{441} (backported from v2.5.3).
   - More robust backup for output files when running over multiple processes
   - Fixed a regression in the performances of GEOMETRY based flexible hills in \ref METAD and \ref PBMETAD
+  - Fixed \issue{538}.
 
 
diff --git a/src/lib/Makefile b/src/lib/Makefile
index cc6860104ea67ce73a506aab8f3fe3602aa5862f..7f4b9865a5e4f9557678955f13d36f43dfa411f1 100644
--- a/src/lib/Makefile
+++ b/src/lib/Makefile
@@ -307,7 +307,7 @@ endif
 # vim syntax file
 	if test -d ../../vim/syntax ; then mkdir -p "$(DESTDIR)$(libdir)/$(program_name)" && cd ../../ && tar cf - vim/syntax | tar xf - -C "$(DESTDIR)$(libdir)/$(program_name)/" ; fi
 	if test -d ../../vim/help ; then mkdir -p "$(DESTDIR)$(libdir)/$(program_name)" && cd ../../ && tar cf - vim/help | tar xf - -C "$(DESTDIR)$(libdir)/$(program_name)/" ; fi
-	if test -f ../../vim/scripts.vim ; then cp ../../vim/scripts.vim  "$(DESTDIR)$(libdir)/$(program_name)/vim/" ; fi
+	if test -f ../../vim/scripts.vim ; then mkdir -p "$(DESTDIR)$(libdir)/$(program_name)/vim" && cp ../../vim/scripts.vim  "$(DESTDIR)$(libdir)/$(program_name)/vim/" ; fi
 # python installation (rebuild prior to installation so as to discover plumed in path)
 ifdef python_bin
 	cp -pr ../../python install