Section 30. If the defendant has judgment for such improvements, he may have an execution therefor or he may collect the same, with all reasonable costs and expenses for such collection, out of the security furnished, or may receive it out of the money paid into court and the residue thereof, if any, shall be returned to the plaintiff.