In lieu of the above and upon the written petition of the owners of more than fifty per cent of the lineal foot frontage of the property abutting on any street or alley, the entire costs of the improvements shall be paid by the owners of real estate abutting on the street or alley to be improved, according to the frontage of the property owned by them, provided that where a railroad bed or track occupies a portion of the street or alley to be improved, the owners thereof shall pay the entire cost of paving of the space occupied by the railroad bed including extra work made necessary by the presence of the track, and provided further that in the event the railroad bed or track is owned by the municipality it shall pay only for the extra work made necessary by the presence of the track in the street.