fix style issues to perms.py and tools.py