Fix list reversal in to_rec

If one of the values passed to to_rec is a list, it will be reversed in the result. This patch fixes it.