Better debug logs, permission update, optional argument fix.