Maintiaing a separate branch off of 68fbe5e91b8d593d7d2c87949344c150bc17...

...3776 and cherry picked changes for permission issue with socket.