changed getComponent() to getRootComponent()