Fixing cursor advancing for begin/end.