0.1.9: add ownership checks, rewrite error handling