Fixed NaN problem (when offset == 0).