Fixes crash on permission check