Fix order of operations