Fix possible time syncronisation issue with first and last functions