Merge branch 'bug-1316' into bug-1050