Fixed two bugs.
Added new feature: Permission support.