bugfix in merging libraries/readlengths, making code more modular