Selection merging bugfix, fixes #41