fixes bugs, updated example