fix stdin reading