Fixed elapsed function.