Fixed line joining + added few tests
Merge pull request #169 from modosist/master

Fixed line joining issues