Contrary to the motion court’s conclusion, defendant did not waive the illegality defense by not raising it in its pleadings. On prior motions defendant had raised the argument that it should not be forced to commit trespass, and plaintiff had responded to the argument. Because plaintiff therefore was not surprised or prejudiced by its assertion, the defense may be entertained.