Moved the assignment out of the conditional