Costs may be allowed to either party upon such petition, and the new trial may be granted upon such terms as the court may deem just.