some bug fixes for the example, and move to a more sane permission format