Fixed compilation errors due to enum/int comparisons and uninitialized variable.