C89 and windows fixes