bugfixes for better client port detection and mysql connection problems