fixed a major bug in CompoundTerm; continuing with unit tests