fix helper function