diff --git a/nifty_gridder.cc b/nifty_gridder.cc
index d68df5db02d949a03a9871c8792d180d8e27ed62..6f5477648e78041516434f69973f462e4274278e 100644
--- a/nifty_gridder.cc
+++ b/nifty_gridder.cc
@@ -29,7 +29,8 @@
 #include "pocketfft_hdronly.h"
 
 #ifdef __GNUC__
-#define RESTRICT __restrict__
+//#define RESTRICT __restrict__
+#define RESTRICT
 #define NOINLINE __attribute__ ((noinline))
 #else
 #define RESTRICT
@@ -903,8 +904,8 @@ template<typename T, typename T2=complex<T>> class Helper
         bv0=((((iv0+nsafe)>>logsquare)<<logsquare))-nsafe;
         if (grid_r) load();
         }
-      p0r = rbuf.data() + sv*(iu0-bu0) + iv0-bv0;
-      p0w = wbuf.data() + sv*(iu0-bu0) + iv0-bv0;
+      p0r = grid_r ? rbuf.data() + sv*(iu0-bu0) + iv0-bv0 : nullptr;
+      p0w = grid_w ? wbuf.data() + sv*(iu0-bu0) + iv0-bv0 : nullptr;
       }
   };
 
@@ -1316,7 +1317,7 @@ template<typename T> pyarr_c<complex<T>> apply_holo(
 
 template<typename T> pyarr_c<T> get_correlations(
   const Baselines<T> &baselines, const GridderConfig<T> &gconf,
-  const pyarr<uint32_t> &idx_, int du, int dv, py::object &wgt_)
+  const pyarr<uint32_t> &idx_, int du, int dv, const py::object &wgt_)
   {
   size_t nu=gconf.Nu(), nv=gconf.Nv();
   size_t w = gconf.W();