Fix several bugs relating to permissions, and add proper support for Run-time permissions.

Signed-off-by: Tyler O'Meara <Tyler@TylerOMeara.com>