reformat code
fix some warnings