fixed a bug that miscalculated runtime