Connection issue fixes for modbus

These fixes I collected from the ml, and probably modified slightly.
I forgot about them in my RH specfile's patches.
It helped at least 3 other people