Several bug fixes (from TE's todo items)

Signed-off-by: Norv <a.w.norv@gmail.com>
Merge pull request #3 from norv/te_various_fixes

Several bug fixes (from TE's todo items)