1. Fix cross correlate shift to be in seconds. 2. add safety check for max()