reformat code
fix 64-bit compiler errors