Minor bugfixes, API cleanup (issues #618, #383)