Change some %lu to %zu for standards conformity/32bit warning removal

Haven't tested this yet. Commit message has more detail.