fixed bug in retrieving permission