bug with excess function fixed