Merge "Fix occasional crash bug with layers" into jb-mr1-dev