bug fixes in timing functions