Merging SkySQL changes back to master

Merging misc bug fixes and changes in the skysql branch to master. These are running in production and shouldn't cause any problems.