added afterBegin to stage.py