Improve behaviour of stdio interface