Changes added by MonoDevelop and other fixes to build and run under Mono