Fix UpdateRecord function's query