fix bad use of result