Ensure safety of old buildings, says court