Fix chmod command and modify some codes
Bug fix