Fix bug with if statement changing an att value