helper function fixed.