adding a PrologParsingException in the right place
fixing a bug in the instrumentation of goals