Fix a bug with order of operations.