fixed bug in measuring time for whole script run