more flexible update_with, fixed #3 #4