convert: fix subtly wrong bug that always returns same value