Several bug fixes (from TE's todo items)

Signed-off-by: Norv <a.w.norv@gmail.com>