Changed buffer content rewite logic

+ Changed buffer content rewite logic, so that rewrite can now occur
after cache plugin/etc