Fix off-by-one in RAM-related functions