fix a type-check and some docstrings