Added sane checks in for missing elements.