Fixed session issues

Fixed session issues by using buffered output

SVN Revision 579