modify earlyvisithandler