Fix some bugs on Boyer-Moore implementation