refine r <-> scheme conversion