fix error in database update when saved variables are incorrect