order of operations fix