Changed reg read/write functions to use nbytes param