I know this test is huge... It would be smaller if the directive definitions weren't there, so they could be moved outside... But I like the locality of reference like this.

I don't totally know if this is the right test for this though. It does work, but I'm not sure if this fix will work in all possible configurations. This is a bit tricky. Some help with this would be awesome.