handle server start and stop