Issues with mongodb drive version >=1.3.0

Merging changes from MongoClient branch to fix issues with latests mongodb php drivers versions in master branch.