attempting to handle shutdown gracefully