update example and fix append to logic