fix int comparisons + other c++ style fixes