bit resolution: 24 -> 16
fix dumb logic error: need curlies in "for" loop