Merge "Fix error handling for non-dynamic permissions" into tm-dev