added in some checks on role edits to prevent NPE