properly return err. fixes #49