Update middleman.py

adding map broadcast fix and zero length message fix