handle multiple onentry and onexit