fixed bug with permission