Fixes for permission, and runtime bug when adding comparison