add method to get state variables used on the operations body
fixed null pointer for cases where machine has no variables