Avoiding nasty floating point precision bug.

Check whether peakVal is 0 in normalize() *before* using it as a float.