Fix bug and add example