in reply to print misbehaves

Sounds like you're suffering from buffering.

Read that and all will be well with the universe.