fixed some timing-related bugs