generic handler cleanup