do the output buffering ourselves; this improves performance a lot