fixed a bug and added an example
updates