Fixed segmentation fault in finding active element.