catches stream exception