Fixed several bugs in correlator due to code review.