Fixes beforeeach and aftereach snippets