make this code a little more c99 compliant