Then when you get to executing the next command, the response to the first command as finally reached the serial buffer and you read it instead. The response to your second command will be sitting in the buffer waiting on the next VISA read.
okay, but finnally that's the CS command which is not interpreted correctly every now and then. As it should be sent from a click event, I was thinking that the CS command would overwrite everything in the serial buffer. apparently not. I will try with a 500ms delay.
Perhaps when you prime the pump, it is better to use the PI command in a loop until prime = 0 and then continue?