add handler hook for shutdown
out of boundary fix