fix bug: Failing to correctly return correct permission