small changes and corrections
correctly compute the error for LMV