(2)Where immediate action is necessary, the Secretary shall, before giving such notice or before the period of notice expires, cause to take such temporary measures as he deems fit to prevent danger, and the cost thereof shall be recoverable from the owner in the manner provided in section 538.