fix bug and function check permisson