fix term argument for lookup
add some log
drop privileges as soon as possible