task: Correct version calculation

Fix a typo, we were comparing last date with last serial thus we wasn't
detecting previous versions correctly not increasing the serial.