fix missing protection in equal and greater in sort.c
fix protection bugs in deriv.c, plus mods entry