fix r_preparemap