Preventing accidents in excavations