Fixed timing related bugs