Fixed bugs in roles and permissions