Some fixes for .net 3.5 target