add example 4 and fix some issues