modify exit method