Section 89. A company shall not be required to keep any portion of the surface material of public ways and bridges in repair, but it shall remain subject to all legal obligations imposed in original grants of locations, and may, as incident to its corporate franchise, and without being subject to the payment of any fee or to any other condition precedent, open any such way or bridge in which any part of its railway is located, in order to make repairs or renewals of the railway, or of any part thereof, and the superintendent of streets or other officer exercising like authority, or the board of aldermen or selectmen shall issue the necessary permits therefor in a city or town where such are required. If, during the original construction or subsequent alteration or extension or the making of any such repairs or renewals of any railway or a portion thereof, said surface material is disturbed, the company which owns or operates such railway shall, at its own cost, except as provided in sections seventy-one and eighty-two, replace to the reasonable satisfaction of the said superintendent, or other officer, said surface material with the same form of construction as that which was disturbed, or, by first obtaining the approval thereof by such officer, with a different material and form of construction, and shall restore said way or bridge to as good condition as existed at the time of such disturbance. Such company shall be liable for any loss or injury sustained by any person in the management and use of its tracks and during the construction, alteration, extension, repair or renewal of its railway, or while replacing the surface of any way disturbed as aforesaid, and resulting from the carelessness, neglect or misconduct of its agents or servants who are engaged in the prosecution of such work, if notice of such loss or injury is given to the company and an action therefor is commenced in the manner provided by section eighteen of chapter eighty-four. This section shall not affect the obligations of any company in respect of the construction or maintenance of any bridge or part thereof which any private person or corporation may be liable, in whole or in part, to construct or maintain.