Fixed some docstring and exception handling