Replacing mistaken assignment with strict equality check