Add proper guards to the read/write macros