In primitive.py fix a bug in trails; correct minor documentation errors