alignment and correlation code fixes