added EXIT hook for status checking