Last fix and some socket checks