improved 'udate_where' function