Replace cleanupServer with functions avalilable in ghc <= 8.4