Fixed bug where expected number of input variables was incorrect if any of the inputs were also outputs