Fixed bugs in the r2_enhance
made changes in the most recent bug fix