Merge PR #2728 and minor fix.[master]