Fix bug and documentation