Added check for valid role object