Analysis of stability of a thin layer of granular material moving on an inclined plane