Use throwIO instead of throw for correctness