Fixed bound checking on read/write