improve procedure queue and minor fixes for c# port