Fixed some range writing bugs.

Signed-off-by: Sophie <sophie@sophie-Inspiron-1564.(none)>