fix directives pattern and add test for exceptions