Improve permission module
permission module seems to work fine now