Merge branch 'bug-413' into bug-1138