update Assign function to fix bug