If on trial the defendant proves that he is such tenant or agent, or the legal owner of such estate, he shall recover his costs to be paid as aforesaid.