Yes, Laurent found the problem - you need to check for more than 1 substrate on it's line. In addition, when I ran the code you posted, I found other errors but I haven't been able to find the cause. Here is my code modified from my original post. It checks for more than 1 substrate (on 1 line).