The problem here is that you are trying to flush the buffer (out),remove it and this will get flushed before the forward happens. Hopethis helps.