throw an error if element is not present

Closes #175