clamp logitinv

also added various (toggled-off) debugging statements

Conflicts:

	src/external.cpp