Fix some .Net Framework 2.0 compatibility issues