Fix for connection errors when using replication
Fix for mariadb as well
Merge pull request #1298 from janmeier/badPooling

Fix for connection errors when using replication