Merge "Fix some crashes in the sample" into jb-mr2-dev