Changed getComponent to cast automatically the component.