Fix bugs in field cursor and foreach updater