fix two small bugs:
- off-by-one-error in addLastSelection
- when cancelling split_selection an error was thrown
add some unit tests