Fixes #2

Fixed a bunch of bugs related to permissions. Some more to address yet.

Signed-off-by: Bruno Alves <bruno.m.alves@gmail.com>