Eng 5316

Fix ENG-5316 and ENG-5338
There is a pro pull request which must be pushed after this.