Fixed various bugs in lda estimator