sao: fix MSVC warnings
sao: fix inf loop bounds