loop only runs once

You may be checking 16 bytes but your buffer is only 15 bytes long.