Fix/clean/clarify some stuff found by coverity scan