fix strange StackOverflow bug in the engine

Fix strange StackOverflow with an even more strange fix,
replacing (empty? (:open-goals state1)) by (zero? (count (:open-goals
state1)))