Minor fixes, mainly for c# support