Fix process exit in server