Fix issue with consumed timestamp, add tests