fix byte compilation
use much simpler search algorithm to restore