Fixed bug in which ignored elements were not being ignored.

Added some tests to ensure it doesn't happen again