Merge pull request #50 from graimundo/5.2

Cherry picked fixes tested in master for 5.2