Section 40. Before a taking is made or injury inflicted by a private corporation for which damages may be recovered under this chapter, such corporation shall give to the board of officers by whom such damages are to be awarded security to their satisfaction for the payment of all damages and costs which may be awarded by them or by the court for the land or other property taken or injured; and if, upon petition of the owner and notice to the adverse party, any security taken appears to them to have become insufficient, they shall require the corporation to give further security to their satisfaction. If the corporation fails to comply with this section any person entitled to such damages may treat the taking of his property or the proceedings by which the right to inflict injury thereon was acquired as void and any interference by such corporation with the use and enjoyment of his property as unlawful.