improve conditions before connection creation