Fixed known bugs in the permissions plugin