Fix UnboundLocalError in serve_papers