fix #2562 extract code samples
Merge pull request #3671 from martinpallmann/issue-2562

fix #2562 extract code samples