fixed threading for outgoing communication and some error handling