r2: clean up and warning fixes