fix for hanging threads and leave message handling