Fixed stdin reading