You are need to "global" $wp_roles before you check if its isset.