bugfix and improve example