Fixes for permissions lookup and checking.