Add proper guards to the read/write macros and fix a mismerge
Add guards to the read/write macros