Fix begin directive parsing to understand empty / nested contents