Implemented test_dispatchermiddleware
Fixed dumb splits

Some splitting (and joining) have being used in a sub-optimal way.
Fix Python 3 compat issues