Merge branch 'bug-1059' into bug-1042