Fixed bug when making an update with joined tables