fix compatibility issues
add docstring